package hu.dobrosi.util;

public class Math {

	public static double round(double v, int a) {
		double p = 1;
		for (int i = 0; i < java.lang.Math.abs(a); i++) {
			p *= 10;
		}
		return a < 0 ? ((long) (v / p)) * p : ((long) (v * p)) / p;
	}

	public static double random() {
		String time = "" + System.currentTimeMillis();
		String s = "0.";
		for (int i = time.length() - 1; i > time.length() - 7; i--) {
			s += time.charAt(i);
		}
		return java.lang.Math
				.abs(java.lang.Math.sin(Double.parseDouble(s) * 6.28));
	}
}
